package com.ouyang.controller;

import com.ouyang.dto.HcEventDTO;
import com.ouyang.service.HkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
public class HkController {

    @Autowired
    private HkService hkService;

    /**
     * 新增订阅事件
     * @return
     */
    @PostMapping("/addEventType")
    public String  addEventType(@RequestBody HcEventDTO hcEventDTO){
      return   hkService.addEventType(hcEventDTO);
    }


    /**
     * 取消订阅事件
     * @return
     */
    @PostMapping("/deleteEventType")
    public String  deleteEventType(@RequestBody HcEventDTO hcEventDTO){
        return  hkService.deleteEventType(hcEventDTO);
    }


    /**
     * 查询订阅事件
     * @return
     */
    @GetMapping("/queryEventType")
    public String  queryEventType(){
        return hkService.queryEventType();
    }

    @PostMapping("/eventRcv")
    public String  eventRcv(@RequestBody String json){
        System.out.println("告警事件---------->"+json);
        hkService.eventRcv(json);
        return "success";
    }

}
